package fly.util;

import fly.help.PrintSupport;
import fly.help.ArraySupport;

import java.util.*;

public class GregorianCalendarDemo {



    public static void main(String[] args) {
        PrintSupport.sout("1");
        int rawOffset = -8*60*60*1000;
        SimpleTimeZone pdt = new SimpleTimeZone(
                rawOffset, TimeZone.getAvailableIDs(rawOffset)[0]
        );

        pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2*60*60*1000);
        pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2*60*60*1000);

        GregorianCalendar cl = new GregorianCalendar(pdt);

        Date dt = new Date();

        cl.setTime(dt);

        Integer[] intArr ={
                Calendar.ERA, Calendar.YEAR, Calendar.MONTH, Calendar.WEEK_OF_YEAR, Calendar.WEEK_OF_MONTH,
                Calendar.DATE, Calendar.DAY_OF_MONTH, Calendar.DAY_OF_YEAR, Calendar.DAY_OF_WEEK,
                Calendar.DAY_OF_WEEK_IN_MONTH, Calendar.AM_PM, Calendar.HOUR, Calendar.HOUR_OF_DAY,
                Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND
        };

        for(Integer itg : intArr){
            System.out.print(cl.get(itg) +";\t");
        }

        PrintSupport.sout("2");

        String[] strArr ={
                cl.getCalendarType(), cl.getGregorianChange().toString(), cl.getTime().toString(), cl.getTimeZone().toString(),
                cl.toZonedDateTime().toString(), cl.toString()
        };
        System.out.println(
                ArraySupport.toString(strArr)
        );
    }
}
